package com.iqiyi.pps.epg.core.service.program;

import com.iqiyi.pps.epg.api.model.web.program.*;
import com.iqiyi.pps.epg.api.model.web.query.TFilter;
import com.iqiyi.pps.epg.api.model.web.query.TPage;
import com.iqiyi.pps.epg.core.model.program.*;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;

import java.util.List;
import java.util.Map;

/**
 * Created by karkarrotxu on 2014/12/1.
 */
public interface ProgramService {
    List<ProgramData> getByDay(String day, int fatherId);

    void saveProgramDataList(List<ProgramData> saveList, long channelId);

    void updateFlagProgramDataList(List<ProgramData> updateList);

    void deleteFlagProgramDataList(List<ProgramData> deleteList);

    int deleteFlagProgramDataListById(List<Long> deleteList);

    ProgramData findProgramDataById(long id);

    ProgramData findProgramDataByQipuId(long qipuId);

    TProgramPage findTProgramChannelPage(TPage page, TFilter filter);

    TProgramPage findLibraryPage(TPage page, TFilter filter);

    TProgram findTProgramById(long id);

    TProgram findTProgramById(long id, boolean needPic);

    void editProgramData(ProgramData programData);

    void editProgramDataBaseList(TProgram entity);

    long saveProgramData(ProgramData programData);

    List<TProgram> findNeedSyncTProgram(int onceNum);

    int recoverSyncStatus();

    int syncProgramDelete(String channelIds);

    int clearAutomation(long channelId, long startTime);

    void syncComplete(List<Long> completeList);

    void doSyncById(long id);

    void doSyncByFatherId(long fatherId);

    void deleteFlagProgramDataListByFatherId(long fatherId);

    boolean checkInRange(int fatherId, String startTime, String endTime, long excludeId);

    List<TProgram> findNotSyncTProgram(long fatherId);

    boolean hasPrograms(long fatherId);

    public String searchProgram(String name, String startDate, String endDate, String porgramQipuId, String channelQipuId, String channelName);

    public String searchFilterProgram(Map<String, String> params);

    boolean checkExistBindEpisode(long fatherId, long tKey);

    List<ProgramRecent> findRecent(List<Long> idList, String dateMin, String dateMax, boolean checkSync);

    public void logoutNoSyncRecent(long fatherId, String dateMin, String dateMax);

    public List<ProgramData> getCurrentAndNextProgram(Long fatherId, Integer size);

    public List<ProgramData> findByQipuIds(List<Long> idList);

    public List<ProgramDataBase> findDataBaseByProgramDataIds(List<Long> idList);

    public List<ProgramDataBase> findDataBaseByProgramDataId(long programId);

    public void insertProgramDataBaseList(List<ProgramDataBase> list);

    boolean updateProgramTimeList(List<TProgramTime> dataList);

    boolean updateProgramTimeList(Map<Long, TProgramTime> dataMap);

    boolean batchUpdateProgramList(List<ProgramData> deleteList);

    List<ProgramData> findProgramDataList(TFilter filter, String orderBy, String order);

    public String queryPuYu(String barCode, String cprVideoName);

    public List<ProgramData> checkListQuery(long minStartTime, long maxStartTime, boolean findDelete);

    public List<ProgramData> doQueryNoticeStart(long minNoticeStartTime, long maxNoticeStartTime);

    public List<ProgramData> findSubscribeQuery(long minStartTime, long maxStartTime);

    public List<ProgramData> programEndQuery(long minEndTime, long maxEndTime);

    public List<ProgramCheckData> findForceCheck();

    public void doEndForceCheck(long programId);

    public List<ProgramData> queryDataByCriterion(List<Criterion> list, List<Order> orderList, int maxResultNum);

    public List<ProgramDataBase> queryDataBaseByCriterion(List<Criterion> list, List<Order> orderList);

    boolean addStreamError(int errorCode, long channelId, long programId, List<String> streamTypeList);

    void updateRecyclablePrograms();

    List<ProgramDataExpired> getExpiredProgramList();

    void insertExpiredProgramList(List<ProgramDataExpired> list);

    void updateDeletedExpiredProgram(ProgramDataExpired program);

    boolean toggleLockProgram(long id, int lockType);

    long findYesDayEndTime(long channelId, long newStartTime);

    long findLastEndTime(long channelId, long newStartTime);

    public List<TLivingInfo> getTLivingInfo();

    List<ProgramData> findNoBroadcastPrograms(long startTime, long endTime, int start, int maxCount);

    List<ProgramData> getCurrentProgram(int fatherId);

    String getMaxDurationProgram(long fatherId);

    int updateToForceCheck(long programId);

    void notifyProgramInLive(long channelId, boolean changeToRun, String streamName);

    int updateMaxPlaybackPeriod(long fatherId, int maxPlaybackPeriod);

    int updatePanoformat(long fatherId, String panoFormat);

    int updateThreeD(long fatherId, String threeDFormat);

    int updatePlayStatus();

    List<TProgram> getSyncQisuProgramList(int resultsBegin, int resultsLimit);


    TProgramLogPage getProgramLogList(TPage page, TFilter filter);

    void saveProgramLog(ProgramLog programLog);

    public void saveProgramLogList(List<ProgramLog> programLogList);

    public List<String> searchForLogUser(long programId);

    public String saveSnapshot(long taskId, String snapshot, String errcode, String errmsg);

    long getProgramCountByFatherId(long fatherId);

    //节目广告相关
    List<ProgramAdvert> findAdvertByfQipuId(long fatherQipuId);

    public void editAdvert(ProgramAdvert programAdvert);

    public long saveAdvert(ProgramAdvert programAdvert);

    public ProgramAdvert findAdvertById(long id);

    public void updateDBAdvert(ProgramData programData);

    public void updateSnapPicUrl(long id, String url);

    public List<Long> findChangeTagProgramIds();

    public long saveOAData(IqiyiOAData data);

    public void updateDocEditStatusByDocNo(IqiyiOAData data);

    public void updateDocEditStatusByDocNo(IqiyiOAData data, int episodeGrade);

    public void doCheckClearFeedById(long programId);

    public List<ProgramData> checkFeedListQuery(long minStartTime, long maxStartTime);

    public void doCheckClearFeedByQipuId(long programQipuId);

    public void addFeedData(FeedData feedData);

    public List<FeedData> findFeedData(List<Criterion> list);

    public void batchUpdateFeedDataList(List<FeedData> dataList);


}
